package down.sallai.ml.services;

import down.sallai.ml.util.HttpsDownUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
@Slf4j
public class DownFile {
    @Value("${mydown.fileLocal}")
    String fileLocal;

    public String downFile(String url,HttpServletRequest request){

        log.info(url+fileLocal);
        try {
            String res = new HttpsDownUtils().downloadFile(url, fileLocal, request);
            return res;
        } catch (Exception e) {
            e.printStackTrace();
            return "下载异常";
        }

    }

}
